package com.zmj.sy.mom.srv.aps.shcedule;


import com.zmj.sy.mom.srv.aps.service.DxfService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;

import java.time.LocalDateTime;

@Slf4j
@Configuration
@RequiredArgsConstructor
@ConditionalOnProperty(name = "scheduler.sync-dxf.enabled", havingValue = "true")
public class SyncDxfSchedule {

    private final DxfService dxfService;

    /**
     * 定时同步dxf数据
     */
    @Scheduled(cron = "${scheduler.sync-dxf.cron}")
    public void syncDxf() {
        log.info("定时同步dxf数据:{}", LocalDateTime.now());
        dxfService.exec();
    }

}
